home *** CD-ROM | disk | FTP | other *** search
/ Ian & Stuart's Australian Mac: Not for Sale / Another.not.for.sale (Australia).iso / fade into you / being there / Rants / KnowBot < prev    next >
Text File  |  1993-10-31  |  27KB  |  805 lines

  1.  
  2.  
  3.  
  4.  
  5. Network Working Group                                         R. Droms
  6. Internet Draft                                                Bucknell
  7.                                                         December, 1989
  8.  
  9.  
  10.                      The Knowbot Information Service
  11.  
  12.  
  13.  
  14. 1  Status of this Memo
  15.  
  16. This Internet Draft specifies the architecture and protocol of the Knowbot
  17. Information Service (KIS), a directory or ``white pages'' service that
  18. provides a uniform interface to existing Internet directory services.  This
  19. service and protocol are experimental; comments and discussion should be
  20. directed to the kis-users@nri.reston.va.us mailing list.
  21.  
  22. This draft document will be submitted to the RFC editor as an Information
  23. document on February 28, 1990.  Distribution of this memo is unlimited.
  24. Please send comments to kis-users@nri.reston.va.us.
  25.  
  26.  
  27. 2  Abstract
  28.  
  29. Within the metanetwork of networks that exchange electronic mail, there are
  30. many directory services that provide partial coverage of network users; that
  31. is, directories with information about some subset of a particular network's
  32. user population.  Searching the collection of available directories is
  33. time-consuming and requires knowledge of each directory's user interface.
  34. Although X.500 is currently under study as a basis for an Internet-wide
  35. directory service, it is unlikely that a universal user registry will be in
  36. place in the near future.  The Knowbot Information Service provides a
  37. uniform interface to heterogeneous directory services that simplifies the
  38. task of locating users in the combined network.
  39.  
  40.  
  41. 3  Introduction
  42.  
  43. The loose confederation of networks that exchange electronic mail, including
  44. the Internet, CSNET, BITNET and UUCP(1) provides services to hundreds of
  45. thousands of users.  Locating a specific user in this collection of networks
  46. is a difficult problem; there is no single directory service in which all
  47. users are represented.  Searching for a user requires that queries be
  48. directed to a collection of more-or-less well-known directory services,
  49. ____________________________
  50.  (1)Quarterman and Hoskins have written a summary of contemporary
  51. networks[8] that includes descriptions of the Internet, CSNET, BITNET, UUCP
  52. and many other public and commercial networks.
  53.  
  54.  
  55.  
  56.  
  57.  
  58. Internet Draft         The Knowbot Information Service        December, 1989
  59.  
  60.  
  61. including whois@NIC.DDN.MIL [4], whois@SH.CS.NET [1], Profile [5] and
  62. X.500 [12].  Of course, each of these services accepts different styles of
  63. queries and returns its responses in a unique format.
  64.  
  65. While the White Pages Pilot Project[10] is exploring the use of X.500 as the
  66. basis for an Internet-wide directory service, we believe that the current
  67. diversity of directory services will persist for some time.  There are also
  68. users of other networks not a part of the Internet that are unlikely to
  69. become part of any Internet-based directory service.  The likelihood that
  70. users will want to query multiple directory services through a single,
  71. uniform interface motivates the development of our new tool.
  72.  
  73. We have developed the Knowbot Information Service (KIS) that uses Knowbots
  74. to automate the process of searching multiple directory services.  KIS is a
  75. directory service user interface that integrates heterogeneous directory
  76. services into a single, uniform service.  In response to user input, KIS
  77. forwards queries to multiple directory services.  The responses are
  78. collected and formatted by KIS into a standard format for presentation to
  79. the user.  The design of KIS is flexible and extensible, allowing convenient
  80. integration of new directories into KIS as they become available.
  81.  
  82.  
  83. 4  Knowbots and KIS
  84.  
  85. The Knowbot model of distributed computation supposes a network of
  86. computational resources, into which Knowbots are launched by network users.
  87. These Knowbots then access network resources on behalf of the user, perhaps
  88. bringing remote data back for local processing or migrating to a remote
  89. location for processing of remote data.  Knowbots visit multiple network
  90. sites and access multiple network services during their lifetime.  Each
  91. Knowbot acts as an independent agent acting on behalf of a user and
  92. reporting results back to the user as computations are completed.
  93.  
  94. Knowbots are part of the ``Digital Library Project'' [3], which will make a
  95. variety of library services available on the National Research Network.
  96. Knowbots are essential to the Digital Library, in that the project is of
  97. large enough scale that automated assistants -- Knowbots -- will be required
  98. to make effective use of the diverse and distributed services and resources
  99. to be provided by the Digital Library.
  100.  
  101. The Knowbot Information System is a distributed service that represents an
  102. early prototype of the Knowbot paradigm.  KIS uses two Knowbots:  one that
  103. performs user interface activities and a second that provides a distributed
  104. user directory ``meta-service''.
  105.  
  106.  
  107. 5  Architecture
  108.  
  109. The underlying model used in KIS is the client-server model, where the KIS
  110. services are provided through a reserved TCP/IP protocol port [6, 9] by a
  111. server Knowbot.  The server fields incoming queries and hands those queries
  112.  
  113. R. Droms                                                        [Page 2]
  114.  
  115.  
  116.  
  117.  
  118.  
  119. Internet Draft         The Knowbot Information Service        December, 1989
  120.  
  121.  
  122. off to sub-processes, which, in turn, send queries to remote directory
  123. services.  The responses are formatted by the sub-processes and returned
  124. through the TCP/IP connection.
  125.  
  126. Users gain access to the KIS services through client Knowbots that
  127. communicate with the server through TCP/IP. In the simplest case, the user
  128. can use telnet [7] to connect directly to the KIS server.  There are client
  129. Knowbots that accept both interactive and electronic mail KIS queries.  The
  130. client/server Knowbot architecture allows the incorporation of new
  131. interaction mechanisms through the development of simple front end Knowbots.
  132. In addition, the use of TCP/IP as a transport protocol allows access to KIS
  133. services from remote sites, which need only implement the interface
  134.  
  135.  
  136. 5.1  Client
  137.  
  138. A user gains access to KIS services through a local user interface Knowbot,
  139. which is run as a user program.  The user Knowbot establishes a TCP
  140. connection with a server Knowbot, through TCP port 186.  After the
  141. connection has been established, the user Knowbot accepts user input,
  142. forwards commands to the server Knowbot and relays responses back to the
  143. user.
  144.  
  145. Currently, there is only one implementation of the user interface Knowbot,
  146. which uses a simple ``dumb terminal'' display model.  An X Window
  147. System [11] interface is under consideration.
  148.  
  149.  
  150. 5.2  Server
  151.  
  152. After the server Knowbot accepts a TCP connection on port 186, it starts a
  153. sub-process as hands the connection to the sub-process for further
  154. processing.  The sub-process accepts commands from the client Knowbot, sends
  155. requests to other directory services and returns the responses back to the
  156. client Knowbot.
  157.  
  158. While the KIS server is currently available on host nri.reston.va.us, it
  159. could easily be made available at other Internet sites.  Because the
  160. directory services are available to all Internet hosts (with the exception
  161. of the MCImail directory service), any KIS server can provide identical
  162. function independent of any other server.
  163.  
  164.  
  165. 5.3  Converting to KIS Format
  166.  
  167. KIS uses AWK [2] to convert queries and responses from KIS format to the
  168. formats used by other directory services.  Each directory service has two
  169. AWK conversion programs, one for queries and one for responses, in a library
  170. of KIS conversion programs.
  171.  
  172. KIS passes the following arguments to each query conversion program:
  173.  
  174. R. Droms                                                        [Page 3]
  175.  
  176.  
  177.  
  178.  
  179.  
  180. Internet Draft         The Knowbot Information Service        December, 1989
  181.  
  182.  
  183.      BEGIN    {
  184.         host = "nic.ddn.mil"
  185.         }
  186.      END    {
  187.         cmd = "/usr/ucb/whois -h " host
  188.         if (ident != "")
  189.          cmd = cmd " !"ident
  190.         else {
  191.          if ((i = index(last\_name, "*")) != 0)
  192.            last_name = substr(last_name, 1, i-1) "..."
  193.          cmd = cmd " ." last_name
  194.          if (first_name != "") cmd = cmd "," first_name
  195.          }
  196.         print cmd
  197.         }
  198.  
  199.            Figure 1:  AWK program for whois@nic.ddn.mil Service.
  200.  
  201.      Korb, John T. (JTK1)           JTK@CS.PURDUE.EDU
  202.         Purdue University
  203.         Department of Computer Science
  204.         West Lafayette, IN 47907
  205.         (317) 463-3644
  206.  
  207.                Figure 2:  Response from whois@nic.ddn.mil.
  208.  
  209. first_name :The first name of the query subject.
  210. last_name :The last name of the query subject.
  211. ident : The service-specific identifier.
  212. org : The organization name qualifier.
  213. host : The host from which the directory service is to be requested.
  214.  
  215. For example, the AWK program in figure 1 generates a request for the
  216. whois@nic.ddn.mil service.  Given input last_name=korb, first_name=john,
  217. host=ddn.nic.mil, the server Knowbot will issue the request:
  218.  
  219.      /usr/ucb/whois -h nic.ddn.mil .korb,john
  220.  
  221. Similarly, the server Knowbot uses an AWK program to reformat responses from
  222. remote directory services into a standard KIS format.  Appendix A shows the
  223. AWK program for responses from whois@nic.ddn.mil.  Figure 2 shows the input
  224. to the program in appendix A and figure 3 shows the resulting response in
  225. KIS format.
  226.  
  227. R. Droms                                                        [Page 4]
  228.  
  229.  
  230.  
  231.  
  232.  
  233. Internet Draft         The Knowbot Information Service        December, 1989
  234.  
  235.  
  236.      Name:         John T. Korb
  237.      Phone:        (317) 463-3644
  238.      E-Mail:       JTK@CS.PURDUE.EDU
  239.      Source:       whois@nic.ddn.mil
  240.      Ident:        JTK1
  241.      Last updated: (unknown)
  242.  
  243.          Figure 3:  Response from whois@nic.ddn.mil in KIS format.
  244.  
  245. 5.4  Client--Server Protocol
  246.  
  247. The client and server Knowbots communicate through a simple ASCII protocol.
  248. Each message in the protocol consists of a string of ASCII characters
  249. terminated by an EOT character.  Messages from the client to the server
  250. consist of a single command word, followed by command parameters, as in the
  251. following example:
  252.  
  253.          "service profile@nri\n"
  254.  
  255. Messages from the server to the client may include multiple newline
  256. characters, as in the following example:
  257.  
  258.          "Name:         Ralph E. Droms\n
  259.          E-Mail:       rdroms@nri.reston.va.us\n
  260.          Source:       profile@nri\n
  261.          Last Updated: (unknown)\n
  262.          Name:         Ralph Droms\n
  263.          Organization: NRI\n
  264.          Address:      1895 Preston White Drive, Suite 100\n
  265.          City:         Reston\n
  266.          State:        VA\n
  267.          Country:      US\n
  268.          Zip:         22091\n
  269.          Phone:        (703) 620-8990\n
  270.          E-Mail:       rdroms@nri.reston.va.us\n
  271.          Source:       profile@nri\n
  272.          Last Updated: July 12 1989\n\004"
  273.  
  274. The protocol is strictly synchronous -- essentially an RPC mechanism.  Each
  275. message from the client to the server is followed by exactly one response
  276. from the server.  If the command word in the client message is thought of as
  277. the name of a remote procedure, the additional words on in the client
  278. message can be thought of as parameters, and the reply from the server as a
  279. returned value, completing the RPC analogy.
  280.  
  281.  
  282.  
  283. R. Droms                                                        [Page 5]
  284.  
  285.  
  286.  
  287.  
  288.  
  289. Internet Draft         The Knowbot Information Service        December, 1989
  290.  
  291.  
  292.  % kis droms                           Searches the default list of directory
  293.                                        services for user droms
  294.  
  295.  % kis -s profile@nri.reston.va.us dromsSearches the Profile service at
  296.                                        nri.reston.va.us for user droms
  297.  
  298.  % kis 'alison brown'                  Searches the default list of directory
  299.                                        services for a user with first name
  300.                                        alison and last name brown
  301.  
  302.  % kis
  303.  > service profile@nri.reston.va.us    Searches the Profile service at
  304.                                        nri.reston.va.us for user droms
  305.                                        (using interactive interface
  306.  
  307.  % kis                                 Is identical to the previous example
  308.  > service profile@nri.reston.va.us
  309.  > query droms
  310.  
  311.  % kis                                 Searches for user alison brown
  312.  > service profile@nri.reston.va.us
  313.  > alison brown
  314.               Figure 4:  Examples of the KIS user interface.
  315.  
  316. 5.5  Implementation
  317.  
  318. One of the primary goals of this project was simplicity.  The implementation
  319. itself is constructed, as much as possible, from existing Unix(2) tools and
  320. application programs.  Unix applications such as whois, profile and finger
  321. provide access to the remote directory services.  The AWK programming
  322. language performs the format translations between the remote directory
  323. services and KIS. The bulk of the server code (400 lines of C) and the
  324. client code (250 lines of C) deal with command line argument parsing and
  325. TCP-based inter-process communication.
  326.  
  327. The key to the flexibility and extensibility of KIS is the implementation of
  328. the query and response translation functions.  KIS uses a series of tables
  329. (really, AWK programs) to specify the set of remote directory services and
  330. to describe the translations required for the queries and responses
  331. exchanged with each remote directory service.  New remote directory services
  332. can be incorporated into KIS by simply adding the name of the service to the
  333. set known to KIS, and defining a new translation description.  For example,
  334. KIS has gained access to the X.500-based White Pages Pilot project by simply
  335. adding configuration information describing the X.500 DUA interface to the
  336. KIS configuration database.  Similarly, KIS provides access to MCImail
  337. ____________________________
  338.  (2)Unix is a registered trademark of AT&T.
  339.  
  340. R. Droms                                                        [Page 6]
  341.  
  342.  
  343.  
  344.  
  345.  
  346. Internet Draft         The Knowbot Information Service        December, 1989
  347.  
  348.  
  349. directory services through an interface application program described in the
  350. KIS configuration database.
  351.  
  352.  
  353. 6  Using KIS
  354.  
  355. There are several interfaces available through the KIS client Knowbot.  The
  356. first is modeled after the whois service, in that it accepts switches on the
  357. command line and returns a single response when the request is complete.
  358. The second interface, described in more detail in section 6.1, allows the
  359. user to formulate queries and receive response interactively.  Other
  360. interfaces, using electronic mail and telnet, are provided through simple
  361. extensions of the interactive and command line interfaces.
  362.  
  363.  
  364. 6.1  Interactive User Interface
  365.  
  366. The model used by KIS is one in which the user forms a search context that
  367. is used by KIS to query the remote directory services and search the
  368. responses.  Any entries that satisfy the search context are returned to the
  369. user.  When used interactively, the user can iteratively refine the search
  370. context and query KIS to successively narrow the search to the desired
  371. entries.  In non-interactive mode, the user forms a single search context
  372. (e.g., through the body of an electronic mail message directed to the KIS
  373. server) from which KIS then performs a single search.
  374.  
  375. The user commands in interactive mode include:
  376.  
  377. service directory-service :Add directory service to the list of directory
  378.      services to be searched by KIS. If directory service is not specified,
  379.      or if the service command is not used, KIS uses a default list of
  380.      directory services.
  381. services :List all services available through kis.
  382. org organization :Use organization as a qualifier to constrain the KIS
  383.      search.
  384. ident identifier :Search for the service specific identifier, rather than a
  385.      user name.
  386. query user-name :Issue a query for user-name.  Equivalent to entering
  387.      user-name with no command.
  388. print : Print the current list of services, organization, user name and
  389.      identifier.
  390. help, ?  :Print a short command summary.
  391. man : Print a longer command description.
  392. quit : Terminate the KIS session.
  393.  
  394. R. Droms                                                        [Page 7]
  395.  
  396.  
  397.  
  398.  
  399.  
  400. Internet Draft         The Knowbot Information Service        December, 1989
  401.  
  402.  
  403. Figure 4 gives a series of examples of the command line and interactive KIS
  404. interfaces.
  405.  
  406.  
  407. 6.2  Current Services
  408.  
  409. KIS has translation programs for the following services:
  410.  
  411.      whois (as provided by nic.ddn.mil)
  412.      whois (as provided by sh.cs.net and identified by KIS as csnet
  413.      profile
  414.      mcimail
  415.      quipu
  416.      finger
  417.  
  418. KIS uses the following list of services at the specified sites by default:
  419.  
  420.  
  421.      whois@nic.ddn.mil
  422.      csnet@sh.cs.net
  423.      profile@nri.reston.va.us
  424.      profile@megaron.arizona.edu
  425.      profile@gwen.cs.purdue.edu
  426.      mcimail@nri.reston.va.us
  427.  
  428.  
  429. 6.3  Mail Interface
  430.  
  431. Host nri.reston.va.us maintains a mail interface to KIS. Mail addressed to
  432. user kis is processed by a KIS client Knowbot as interactive input.  The
  433. response from the KIS client is returned to the mail sender in a return mail
  434. message.  Multiple commands and queries can be packaged into one mail
  435. request, and all responses will be returned in a single mail reply.
  436.  
  437.  
  438. 6.4  Telnet Interface
  439.  
  440. Host nri.reston.va.us also provides a telnet-compatible interface to a KIS
  441. client Knowbot through port 185.  Telnet connections to nri.reston.va.us,
  442. port 185 are fielded by the Unix inetd program, and handed off to a KIS
  443. client Knowbot.
  444.  
  445.  
  446. 7  Status
  447.  
  448. KIS is implemented as two C programs, a collection of AWK programs and other
  449. support files on a Sun 4/280 running SunOS 4.0.  The KIS client Knowbot has
  450.  
  451. R. Droms                                                        [Page 8]
  452.  
  453.  
  454.  
  455.  
  456.  
  457. Internet Draft         The Knowbot Information Service        December, 1989
  458.  
  459.  
  460. been ported and run on a VAX 11/780 running 4.3BSD Unix.  The code should be
  461. compatible with any version of Unix that supports the Berkeley-style socket
  462. interface.
  463.  
  464.  
  465. 8  Acknowledgement
  466.  
  467. This work was undertaken with the support of the Corporation for National
  468. Research Initiatives, Reston, VA.
  469.  
  470.  
  471. 9  Author's address
  472.  
  473. The author's current address is:
  474.  
  475.  
  476.      Ralph Droms
  477.      Computer Science Department
  478.      Bucknell University
  479.      Lewisburg, PA 17837
  480.      (717) 524-1145
  481.      droms@sol.bucknell.edu
  482.  
  483.  
  484. References
  485.  
  486.  [1] User Name Server:  Introduction. CSNET Coordination and Information
  487.      Center, October 1988. (Available as NS--1 from info-server@sh.cs.net).
  488.  [2] Alfred Aho, Brian W. Kernighan, and Peter Weinberger. Awk -- A Pattern
  489.      Scanning and Processing Language. Technical report, Bell Laboratories,
  490.      Murray Hill, NJ, 1974.
  491.  [3] Vinton Cerf and Robert Kahn. The Digital Library Project. Technical
  492.      report, Corporation for National Research Initiatives, 1895 Preston
  493.      White Drive, Reston VA, 1988.
  494.  [4] K. Harrenstien, M. Stahl, and E. Feinler. NICNAME/WHOIS. RFC 954, NIC,
  495.      October 1988.
  496.  [5] Larry L. Peterson. The Profile Naming Service. ACM Transactions on
  497.      Computer Systems, 6(4):341--364, November 1988.
  498.  [6] J. Postel. Transmission Control Protocol. RFC 793, NIC, September
  499.      1981.
  500.  [7] J. Postel and J. Reynolds. TELNET Protocol Specification. RFC 854,
  501.      NIC, May 1983.
  502.  [8] John S. Quarterman and Josiah C. Hoskins. Notable Computer Networks.
  503.      Communications of the ACM, 29(10), October 1986.
  504.  
  505. R. Droms                                                        [Page 9]
  506.  
  507.  
  508.  
  509.  
  510.  
  511. Internet Draft         The Knowbot Information Service        December, 1989
  512.  
  513.  
  514.  [9] S. Romano, M. Stahl, and M. Recker. Internet Numbers. RFC 1062, NIC,
  515.      August 1988.
  516. [10] Marshall T. Rose and Martin L. Schoffstall. An Introduction to a
  517.      NYSERNet White Pages Pilot Project. Technical report, NYSERNet, Inc.,
  518.      Troy, NY, 1989.
  519. [11] Robert W. Scheifler and Jim Gettys. The X Window System. Digital
  520.      Press, 1988.
  521. [12] CCITT Recommendation X.500. The Directory -- Overview of Concepts,
  522.      Models and Services. International Telegraph and Telephone
  523.      Consultative Committee, December 1988.
  524.  
  525.  
  526.  
  527. R. Droms                                                       [Page 10]
  528.  
  529.  
  530.  
  531.  
  532.  
  533. Internet Draft         The Knowbot Information Service        December, 1989
  534.  
  535.  
  536. A  AWK Program to Translate Response from whois@nic.ddn.milinto KIS Format
  537.  
  538. BEGIN {
  539.     collecting_address = 0;
  540.     last_rec = "";
  541.     next_to_last_rec = "";
  542.     found = 0;
  543.     read_multiple = 0;
  544.   }
  545.  
  546. /No match/ {
  547. # name not found
  548.     if (first_name != "")
  549.         print "No matches found for " first_name " " last_name "
  550.                    from service " service "@" host
  551.     else
  552.         print "No matches found for " last_name "
  553.                    from service " service "@" host
  554.     found = 0;
  555.     exit;
  556.   }
  557.  
  558. /timed out/ {
  559. # network down
  560.     print "Unable to connect to " service "@" host
  561.     found = 0;
  562.     exit;
  563.   }
  564.  
  565. /refused/ {
  566. # server down
  567.     print "Unable to connect to " service "@" host
  568.     found = 0;
  569.     exit;
  570.   }
  571.  
  572. /host unknown/ {
  573. # network down?
  574.     print "Unable to connect to " service "@" host
  575.     found = 0;
  576.     exit;
  577.   }
  578.  
  579. /unreachable/ {
  580.     print "Unable to connect to " service "@" host
  581.     found = 0;
  582.     exit;
  583.   }
  584.  
  585. NR == 1 {
  586.     found = 1
  587.  
  588. R. Droms                                                       [Page 11]
  589.  
  590.  
  591.  
  592.  
  593.  
  594. Internet Draft         The Knowbot Information Service        December, 1989
  595.  
  596.  
  597.     last_name  = substr($1, 1, length($1)-1);
  598.     given_name = $2;
  599.     i = 3;
  600.     other_name = " "
  601.     while (substr($i, 1, 1) != "(") {
  602.       other_name = other_name $3 " ";
  603.       i++;
  604.     }
  605.     ident = substr($i, 2, length($i) - 2);
  606.     i++;
  607.     e_mail_address = $i;
  608. # Possible phone number all on one line
  609.     organization_phone = "";
  610.     for (i++; i <= NF; i++) {
  611.       if (organization_phone != "")
  612.         organization_phone = organization_phone " ";
  613.       organization_phone = organization_phone $i;
  614.     }
  615.   }
  616.  
  617. NR == 2 {
  618. # Is this the start of multiple responses?
  619.     if (substr($0, 1, 1) != " " && substr($0, 1, 1) != "        ") {
  620.       print "Name:         " given_name other_name last_name;
  621.       if (organization_phone != "")
  622.         print "Phone:        " organization_phone;
  623.       if (e_mail_address != "")
  624.         print "E-Mail:       " e_mail_address;
  625.       print "Source:       whois@nic.ddn.mil";
  626.       if (ident != "")
  627.         print "Ident:        " ident;
  628.       print "Last updated: (unknown)";
  629.       last_name  = substr($1, 1, length($1)-1);
  630.       given_name = $2;
  631.       i = 3;
  632.       other_name = " "
  633.       while (substr($i, 1, 1) != "(") {
  634.         other_name = other_name $3 " ";
  635.         i++;
  636.       }
  637.       ident = substr($i, 2, length($i) - 2);
  638.       i++;
  639.       e_mail_address = $i;
  640. # Possible phone number all on one line
  641.       organization_phone = "";
  642.       for (i++; i <= NF; i++) {
  643.         if (organization_phone != "")
  644.          organization_phone = organization_phone " ";
  645.         organization_phone = organization_phone $i;
  646.         }
  647.       read_multiple = 1;
  648.  
  649. R. Droms                                                       [Page 12]
  650.  
  651.  
  652.  
  653.  
  654.  
  655. Internet Draft         The Knowbot Information Service        December, 1989
  656.  
  657.  
  658.       next;
  659.     } else if (substr($0, 1, 1) == "    ") {
  660.       organization_phone = "";
  661.       for (i = 1; i <= NF; i++) {
  662.         if (organization_phone != "")
  663.          organization_phone = organization_phone " ";
  664.         organization_phone = organization_phone $i;
  665.       }
  666.       read_multiple = 1;
  667.       next;
  668.     } else {
  669.       organization_name = substr($0, 4, length($0) - 3);
  670.       collecting_address = 1;
  671.       next;
  672.     }
  673.   }
  674.  
  675. read_multiple == 1 {
  676.     if (substr($0, 1, 1) != " " && substr($0, 1, 1) != "        ") {
  677.       print "Name:         " given_name other_name last_name;
  678.       if (organization_phone != "")
  679.         print "Phone:        " organization_phone;
  680.       if (e_mail_address != "")
  681.         print "E-Mail:       " e_mail_address;
  682.       print "Source:       whois@nic.ddn.mil";
  683.       if (ident != "")
  684.         print "Ident:        " ident;
  685.       print "Last updated: (unknown)";
  686.       if (substr($0, 1, 1) == "\r")
  687.         exit;
  688.       last_name  = substr($1, 1, length($1)-1);
  689.       given_name = $2;
  690.       i = 3;
  691.       other_name = " "
  692.       while (substr($i, 1, 1) != "(") {
  693.         other_name = other_name $3 " ";
  694.         i++;
  695.       }
  696.       ident = substr($i, 2, length($i) - 2);
  697.       i++;
  698.       e_mail_address = $i;
  699. # Possible phone number all on one line
  700.       organization_phone = "";
  701.       for (i++; i <= NF; i++) {
  702.         if (organization_phone != "")
  703.          organization_phone = organization_phone " ";
  704.         organization_phone = organization_phone $i;
  705.         }
  706.       read_multiple = 1;
  707.     } else if (substr($0, 1, 1) == "    ") {
  708.       organization_phone = "";
  709.  
  710. R. Droms                                                       [Page 13]
  711.  
  712.  
  713.  
  714.  
  715.  
  716. Internet Draft         The Knowbot Information Service        December, 1989
  717.  
  718.  
  719.       for (i = 1; i <= NF; i++) {
  720.         if (organization_phone != "")
  721.          organization_phone = organization_phone " ";
  722.         organization_phone = organization_phone $i;
  723.       }
  724.       read_multiple = 1;
  725.     }
  726.   }
  727.  
  728. collecting_address == 1 {
  729.     if (next_to_last_rec != "") {
  730.       if (organization_address != "")
  731.         organization_address = organization_address ", ";
  732.       organization_address = organization_address next_to_last_rec;
  733.     }
  734.     if (substr($1, 1, 1) == "(") {
  735.       split(last_rec, last_rec_fields, " ");
  736.       organization_city = "";
  737.       i = 1;
  738.       while (index(last_rec_fields[i], ",") == 0) {
  739.         organization_city = organization_city last_rec_fields[i] " ";
  740.         i++;
  741.       }
  742.       organization_city = \
  743.         organization_city \
  744.         substr(last_rec_fields[i], 1, length(last_rec_fields[i]) - 1);
  745.       i++;
  746.       organization_state = last_rec_fields[i];
  747.       i++;
  748.       organization_zip_code = last_rec_fields[i];
  749. # Some responses have "\r\n" line terminators...
  750.       if (index($0, "\r") != 0)
  751.         organization_phone = substr($0, 4, length($0) - 4);
  752.       else
  753.         organization_phone = substr($0, 4, length($0) - 3);
  754.  
  755.       collecting_address = 0;
  756.     } else {
  757.       next_to_last_rec = last_rec;
  758. # Some responses have "\r\n" line terminators...
  759.       if (index($0, "\r") != 0)
  760.         last_rec = substr($0, 4, length($0) - 4);
  761.       else
  762.         last_rec = substr($0, 4, length($0) - 3);
  763.     }
  764.   }
  765.  
  766. END    {
  767.     if (found == 1 && read_multiple == 0) {
  768.       print "Name:         " given_name other_name last_name;
  769.       if (organization_name != "")
  770.  
  771. R. Droms                                                       [Page 14]
  772.  
  773.  
  774.  
  775.  
  776.  
  777. Internet Draft         The Knowbot Information Service        December, 1989
  778.  
  779.  
  780.         print "Organization: " organization_name;
  781.       if (organization_address != "")
  782.         print "Address:      " organization_address;
  783.       if (organization_city != "")
  784.         print "City:         " organization_city;
  785.       if (organization_state != "") {
  786.         print "State:        " organization_state;
  787.         print "Country:      US";
  788.       }
  789.       if (organization_zip_code != "")
  790.         print "Zip:         " organization_zip_code;
  791.       if (organization_phone != "")
  792.         print "Phone:        " organization_phone;
  793.       if (e_mail_address != "")
  794.         print "E-Mail:       " e_mail_address;
  795.       print "Source:       whois@nic.ddn.mil";
  796.       if (ident != "")
  797.         print "Ident:        " ident;
  798.       print "Last Updated: (unknown)";
  799.     }
  800.   }
  801.  
  802.  
  803.  
  804. R. Droms                                                       [Page 15]
  805.